package com.naughty.userlogin02.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class LoginTController {
    @Autowired
    TeacherDao teacherDao;

    @CrossOrigin
    @RequestMapping("/logint")
    public String teacherLogin(@RequestBody Teacher teacher) {
        System.out.println("Teacher : " + teacher);
        String str = "error";
        int count = teacherDao.getTeacherByMassage(teacher.getTname(), teacher.getTpwd());
        if (count > 0) {
            str = "ok";
        }
        return str;
    }
}

